#include "../Logger.hpp"
#include "../Helper.hpp"
#include <unistd.h>

using namespace mq;
using namespace std;

void sqlite_test()
{
    SqliteHelper sqlite("abc.db");
    sqlite.open();
    sqlite.exec("create table if not exists student(sn int primary key, name varchar(32), age int);", NULL, NULL);
    sqlite.close();
}

void uuid_test()
{
    string uuid1 = UUIDHelper::uuid();
    string uuid2 = UUIDHelper::uuid();
    cout << "uuid1:" << uuid1 << endl;
    cout << "uuid2:" << uuid2 << endl;
}

void splite_test()
{
    string str = "abc\r\n\r\nusaih\r\n\r\nshaiu\r\n";
    vector<string> ret;
    size_t n = StrHelper::split(str, "\r\n", ret);
    cout << "n:" << n << endl;
    for (const auto &s : ret)
    {
        cout << s << endl;
    }
}

void log_test()
{
    DLOG("all success!");
}

void file_test()
{
    FileHelper fhelper("./aaa/bbb/a.txt");
    fhelper.createFile();
    sleep(3);
    fhelper.rename("./aaa/bbb/b.txt");
}

int main()
{
    // sqlite_test();
    // uuid_test();
    // splite_test();
    // log_test();
    // file_test();
    return 0;
}